#ifndef MUSICSLIDER_H
#define MUSICSLIDER_H

#include <QWidget>
#include <QMouseEvent>
#include <QPoint>

namespace Ui {
class MusicSlider;
}

class MusicSlider : public QWidget
{
    Q_OBJECT

public:
    explicit MusicSlider(QWidget *parent = nullptr);
    ~MusicSlider();
    //重写鼠标点击移动放开事件，来模拟操作拉进度条的操作
    void mousePressEvent(QMouseEvent* event)override;
    void mouseMoveEvent(QMouseEvent* event)override;
    void mouseReleaseEvent(QMouseEvent *event) override;
    void moveSlider();              //移动进度条到对对应的位置
    void setStep(float bf);                 //设置进度条的移动
signals:
    void setMusicSliderPosition(float);
private:
    Ui::MusicSlider *ui;
    int curPos;         //记录当前的进度
    int maxWidth;       //记录进度条的最长的长度
};

#endif // MUSICSLIDER_H
